package com.xm_jd.controller.jiesuan;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xm_jd.model.dao.BalanceDao;
import com.xm_jd.model.entitys.tb_sh;
import com.xm_jd.model.entitys.user;
import com.xm_jd.utils.BaseServlet;

/**
 * Servlet implementation class AddressServlet
 */
@WebServlet("/addresslist")
public class AddressServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AddressServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//��ѯ�ջ���ַ
		request.setCharacterEncoding("utf-8");
		
		user aa=(user) request.getSession().getAttribute("users");
		
		List<tb_sh> list = new BalanceDao().selectSh(aa.getUser_id());
		request.setAttribute("address", list);
		System.out.println("dz:"+list);
		//response.sendRedirect("jsps/address.jsp");
		this.forward("address");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
